import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
    {//首页
        path: '/',
        name: 'home',
        component: () => import( '../views/home.vue')
    },
    {//首页
        path: '/home',
        redirect: { name: 'home' },
        component: () => import( '../views/home.vue')
    },
    {//关于我们
        path: '/about',
        name: 'about',
        component: () => import('../views/about.vue')
    },
    {//科研创新
        path: '/scientific',
        name: 'scientific',
        component: () => import('../views/scientific.vue')
    },
    { //科研创新详情
        path: '/scientific_details',
        name: 'scientific_details',
        component: () => import('../views/scientific_details.vue')
    },
    { //菌种资源库
        path: '/repositories',
        name: 'repositories',
        component: () => import('../views/repositories')
    },
    { //菌种资源库详情
        path: '/repositories/:id',
        name: 'repositories_details',
        component: () => import('../views/repositories_details')
    },
    { //智慧工厂
        path: '/factory',
        name: 'factory',
        component: () => import('../views/factory')
    },
    { //益生菌原料
        path: '/products_probiotic',
        name: 'products_probiotic',
        component: () => import('../views/products_probiotic')
    },
    { //定制化解决方案
        path: '/products_customization',
        name: 'products_customization',
        component: () => import('../views/products_customization')
    },
    { //品牌产品
        path: '/products_brand',
        name: 'products_brand',
        component: () => import('../views/products_brand')
    },
    {//品牌产品详情
        path: '/products_brand/:id',
        name: 'products_brand_details',
        component: () => import('../views/products_brand_details')
    },
    {//动植物微生态制剂
        path: '/products_preparation',
        name: 'products_preparation',
        component: () => import('../views/products_preparation')
    },
    {
        //新闻中心详情
        path: '/news/:cid/:id',
        name: 'news_details',
        component: () => import('../views/news_details')

    },
    {//新闻中心
        path: '/news',
        name: 'news_index',
        redirect: '/news/12',
        component: () => import('../views/news'),
        children: [{
            path: ':cid',
            name: 'news',
            component: () => import('../views/newslist')
        }]
    },
    {//临床试验
        path: '/clinicaltrial',
        name: 'clinicaltrial',
        component: () => import('../views/clinicaltrial')
    },
    {//投资者关系
        path: '/relations',
        name: 'relations',
        component: () => import('../views/relations')
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router
